﻿using Microsoft.Xna.Framework;
using SFML.Graphics;
using SFML.Window;

namespace Theta
{
    public class Converter
    {
        public static float PixelsInMeter = 64f;
        
        public static float ToMeters(float pixels)
        {
            return pixels / PixelsInMeter;
        }
        
        public static float ToPixels(float meters)
        {
            return meters * PixelsInMeter;
        }

        public static Vector2i ToMeters(Vector2i vec)
        {
            vec.X /= (int)PixelsInMeter;
            vec.Y /= (int)PixelsInMeter;
            return vec;
        }

        public static Vector2i ToPixels(Vector2i vec)
        {
            vec.X *= (int)PixelsInMeter;
            vec.Y *= (int)PixelsInMeter;
            return vec;;
        }

        public static Vector2f ToMeters(Vector2f vec)
        {
            vec.X /= PixelsInMeter;
            vec.Y /= PixelsInMeter;
            return vec;
        }

        public static Vector2f ToPixels(Vector2f vec)
        {
            vec.X *= PixelsInMeter;
            vec.Y *= PixelsInMeter;
            return vec;;
        }

        public static Vector2 ToMeters(Vector2 vec)
        {
            return vec / PixelsInMeter;
        }

        public static Vector2 ToPixels(Vector2 vec)
        {
            return vec * PixelsInMeter;
        }
        
        public static Vector2f ToVector2f(Vector2 vec)
        {
            return new Vector2f(vec.X, vec.Y);
        }

        public static Vector2i ToVector2i(Vector2 vec)
        {
            return new Vector2i((int)vec.X, (int)vec.Y);
        }

        public static Vector2 ToVector2(Vector2f vec)
        {
            return new Vector2(vec.X, vec.Y);
        }

        public static Vector2 ToVector2(Vector2i vec)
        {
            return new Vector2(vec.X, vec.Y);
        }
    }
}
